import pymysql


class MySQLDB:
    """
    为了保障用户数据安全，数据库没有任何上传信息操作
    """
    @staticmethod
    def get_one_data(y1, m, d):
        """
        获取具体一天的时间信息
        :param y1:年
        :param m:月
        :param d:日
        :return:
        """
        connection = pymysql.connect(host='用自己的数据库地址',
                                     user='账号',
                                     password='密码',
                                     db='arm_calendar')

        try:
            with connection.cursor() as cursor:
                sql = "SELECT * FROM year_info where year='%s' and month='%s' and day='%s'" % (
                    y1, int(m), int(d))
                cursor.execute(sql)
                return cursor.fetchall()
        except pymysql.MySQLError as e:
            print(f"Error: unable to update score {e}")
        finally:
            connection.close()
